#pragma once
#include <functional>
#include "ExecutorImpl.hpp"
namespace adas
{
    class MoveCommand final//前进函数
    {
    public:
        void operator()(PoseHandler& poseHandler) const noexcept
        {
            if(poseHandler.IsBus()){
                if(poseHandler.IsFast()){
                    if(poseHandler.IsReverse()){
                        poseHandler.Backward();
                    } else {
                        poseHandler.Move();
                    }
                }
                if(poseHandler.IsReverse()){
                    poseHandler.Backward();
                } else {
                    poseHandler.Move();
                }//对于跑车的前进函数行为判断
            } else {
                if(poseHandler.IsFast()){
                    if(poseHandler.IsReverse()){
                        poseHandler.Backward();
                        poseHandler.Backward();
                    } else {
                        poseHandler.Move();
                        poseHandler.Move();
                    }
                }
                if(poseHandler.IsReverse()){
                    poseHandler.Backward();
                    poseHandler.Backward();
                } else {
                    poseHandler.Move();
                    poseHandler.Move();
                }//对于公交车的前进函数行为判断
            }
        }
    };
    class TurnLeftCommand final//左转函数
    {
    public:
        void operator()(PoseHandler& poseHandler) const noexcept
        {
            if(poseHandler.IsBus()){
                if (poseHandler.IsFast()) {
                    if (poseHandler.IsReverse()) {
                        poseHandler.Backward();
                    } else {
                        poseHandler.Move();
                    }
                }
                if (poseHandler.IsReverse()) {
                    poseHandler.Backward();
                    poseHandler.TurnRight();
                } else {
                    poseHandler.Move();
                    poseHandler.TurnLeft();
                }//对于跑车的左转函数行为判断
            } else {
                if (poseHandler.IsFast()) {
                    if (poseHandler.IsReverse()) {
                        poseHandler.Backward();
                    } else {
                        poseHandler.Move();
                    }
                }
                if (poseHandler.IsReverse()) {
                    poseHandler.TurnRight();
                    poseHandler.Backward();
                } else {
                    poseHandler.TurnLeft();
                    poseHandler.Move();
                }//对于公交车的左转函数行为判断
            }
        }
    };
    class TurnRightCommand final//右转函数
    {
    public:
        void operator()(PoseHandler& poseHandler) const noexcept
        {
            if(poseHandler.IsBus()){
                if (poseHandler.IsFast()) {
                    if (poseHandler.IsReverse()) {
                        poseHandler.Backward();
                    } else {
                        poseHandler.Move();
                    }
                }
                if (poseHandler.IsReverse()) {
                    poseHandler.Backward();
                    poseHandler.TurnLeft();
                } else {
                    poseHandler.Move();
                    poseHandler.TurnRight();
                }//对于跑车的右转函数行为判断
            } else {
                if (poseHandler.IsFast()) {
                    if (poseHandler.IsReverse()) {
                        poseHandler.Backward();
                    } else {
                        poseHandler.Move();
                    }
                }
                if (poseHandler.IsReverse()) {
                    poseHandler.TurnLeft();
                    poseHandler.Backward();
                } else {
                    poseHandler.TurnRight();
                    poseHandler.Move();
                }//对于公交车的右转函数行为判断
            }
        }
    };
    class FastCommand final//加速函数
    {
    public:
        void operator()(PoseHandler& poseHandler) const noexcept
        {
            poseHandler.Fast();
        }//对于加速函数行为的判断
    };
    class ReverseCommand final//后退函数
    {
    public:
        void operator()(PoseHandler& poseHandler) const noexcept
        {
            poseHandler.Reverse();
        }//对于后退函数行为的判断
    };
    class BusCommand final//（公交车/跑车）函数
    {
    public:
        void operator()(PoseHandler& poseHandler) const noexcept
        {
            poseHandler.Bus();
        }//对于跑车还是公交车的判断
    };
}